home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / 4_helicopter_tr_human_scripts.lua < prev    next >
Encoding:
Text File  |  2009-04-28  |  7.6 KB  |  192 lines

  1.  
  2. function units_helicopter_tr_human_setup()
  3.     units_setup(2,true,ENET_EFFECT_PS_SETUPSMOKE_MEDIUM,ENET_EFFECT_GEOMETRY_HELICOPTERALIENSHADOW,true)
  4.     local unit = uniGetExecutor()
  5.     unit:getBone(ENBT_FAN,0):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI / 2)
  6.     unit:getBone(ENBT_FAN,1):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI / 2)
  7.     unit:getBone(ENBT_FAN,0):addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER2)
  8.     unit:getBone(ENBT_FAN,1):addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER)
  9.     unit:addSimpleEffect(ENET_EFFECTEMITTER_HELICOPTERWATERWAVES)
  10.     unit:addSimpleEffect(ENET_EFFECT_HELICOPTER_WATERWAVES2)
  11. end
  12.  
  13. function units_helicopter_tr_human_resetup()
  14.     units_setup(2,true,nil,ENET_EFFECT_GEOMETRY_HELICOPTERALIENSHADOW,true)
  15.     local unit = uniGetExecutor()
  16.     unit:getBone(ENBT_FAN,0):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI / 2)
  17.     unit:getBone(ENBT_FAN,1):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI / 2)
  18.     unit:getBone(ENBT_FAN,0):addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER2)
  19.     unit:getBone(ENBT_FAN,1):addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER)
  20.     unit:addSimpleEffect(ENET_EFFECTEMITTER_HELICOPTERWATERWAVES)
  21.     unit:addSimpleEffect(ENET_EFFECT_HELICOPTER_WATERWAVES2)
  22. end
  23.  
  24. function units_helicopter_tr_human_select()
  25.     units_select(12,1)
  26. end
  27.  
  28. function units_helicopter_tr_human_unselect()
  29.     units_unselect()
  30. end
  31.  
  32. function units_helicopter_tr_human_selectenemy()
  33.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  34. end
  35.  
  36. function units_helicopter_tr_human_damaged()
  37.     uniGetExecutor():applyDamage(uniGetLife())
  38. end
  39.  
  40. function units_helicopter_tr_human_highlight()
  41.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  42. end
  43.  
  44. function units_helicopter_tr_human_explode()
  45.     uniGetExecutor():getBone(ENBT_FAN,1):findEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER):destroy()
  46.     units_explode_fire()
  47. end
  48.  
  49. function units_helicopter_tr_human_fire()
  50. end
  51.  
  52. function units_helicopter_tr_human_move()
  53.     local unit = uniGetExecutor()
  54.     local mover = unit:helicopterMover()
  55.     if (mover~=false) then waitDeath(mover) end
  56.  
  57. --    local sound = unit:play3DSound("chopper.wav",1)
  58. --waitDeath(unit:helicopterFly(uniGetPosition()))
  59.     unit:helicopterFly(uniGetPosition())
  60. --    sound:destroy()
  61. end
  62.  
  63. function units_helicopter_tr_human_load()
  64.     local unit = uniGetExecutor()
  65.     local cargo = uniGetTarget()
  66.     units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
  67.     unit:play3DSound("chopper fade.wav",0)
  68.     local hPos = unit:getHelicopterTarget()
  69.     waitDeath(unit:helicopterFly(cargo:getWorldPosition()))
  70.     unit:play3DSound("dragon load.wav",0)
  71.     uniSetPosition(unit:getBone(ENBT_FIRE1):getWorldPosition())
  72. --    local sound = unit:play3DSound("chopper.wav",1)
  73.     cargo:setTransformOwner(units_findfreefirespot(unit,1))
  74.     cargo:setVisibility(true,true)
  75.     cargo:setLocalPosition(0,0,0)
  76.     cargo:setLocalOrientation(0,1,0,0,0,1)
  77.     unit:helicopterFly(hPos) 
  78. --    waitDeath(unit:helicopterFly(hPos))
  79. --    sound:destroy()
  80.     cargo:terminateCommand()
  81. end
  82.  
  83. function units_helicopter_tr_human_unload()
  84.     local unit = uniGetExecutor()
  85.     local cargo = uniGetTarget()
  86.     units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
  87.     local hPos = unit:getHelicopterTarget()
  88.     unit:play3DSound("chopper fade.wav",0)
  89.     waitDeath(unit:helicopterFly(uniGetPosition()))
  90.     unit:play3DSound("dragon load.wav",0)
  91.     cargo:setTransformOwner()
  92. --    local sound = unit:play3DSound("chopper.wav",1)
  93.     unit:helicopterFly(hPos)
  94. --    sound:destroy()
  95.     cargo:terminateCommand()
  96. end
  97.  
  98. function units_helicopter_tr_human_transfer()
  99.     local unit = uniGetExecutor()
  100.     local cargo = uniGetTarget()
  101.     units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
  102.     local from = cargo:getTransformOwner():getTransformOwner()
  103.     local fromType = from:getEffectType()
  104.     units_waitCommandByUID(from,unit:getCurrentCommandUID() - 2)    
  105.     if(fromType == ENET_UNIT_TRANSCHOPPER_HUMAN) then
  106.         waitDeath(from:parabolicTargetting(unit))
  107.         cargo:setTransformOwner()
  108.         units_helicopter_tr_human_load()
  109.         from:setCurrentAnimationRepeatCount(0)
  110.         from:terminateCommand()
  111.     elseif(fromType == ENET_UNIT_LANDTRANSPORT or fromType == ENET_UNIT_SEATRANSPORT) then
  112.         waitDeath(from:parabolicTargetting(unit))
  113.         cargo:setTransformOwner()
  114.         from:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
  115.         from:addAnimationToQueue(ENAT_FIREPOSITION1,MATH_INFINITY)
  116.         from:addAnimationToQueue(ENAT_AFTERFIRE1,1)
  117.         units_unload_growth(cargo)
  118.         cargo:setTransformOwner()
  119.         cargo:setVisibility(true,false)
  120.         units_helicopter_tr_human_load()
  121.         from:setCurrentAnimationRepeatCount(0)
  122.         from:terminateCommand()
  123.     else
  124.         consoleWrite("attempt to reload from unknown transport type!!!")
  125.     end
  126. end
  127.  
  128. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_MOVE,"units_helicopter_tr_human_move")
  129. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_FIRE1,"units_helicopter_tr_human_fire")
  130. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_FIRE2,"units_helicopter_tr_human_fire")
  131. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_SELECT,"units_helicopter_tr_human_select")
  132. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_SELECTENEMY,"units_helicopter_tr_human_selectenemy")
  133. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_UNSELECT,"units_helicopter_tr_human_unselect")
  134. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_SETUP,"units_helicopter_tr_human_setup")
  135. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_RESETUP,"units_helicopter_tr_human_resetup")
  136. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_DAMAGED,"units_helicopter_tr_human_damaged")
  137. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_EXPLODE,"units_helicopter_tr_human_explode")
  138. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_HIGHLIGHT,"units_helicopter_tr_human_highlight")
  139. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_LOAD,"units_helicopter_tr_human_load")
  140. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_UNLOAD,"units_helicopter_tr_human_unload")
  141. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_TRANSFER,"units_helicopter_tr_human_transfer")
  142. registerCommand(ENSCRIPTSET_TRANSCHOPPER_HUMAN,ENC_INSIDE,"units_inside")
  143.  
  144. -- make description of unit
  145. desc = getEffectDescriptionP(ENET_UNIT_TRANSCHOPPER_HUMAN)
  146. desc.ClassID = ENCLASS_MESHINSTANCE
  147. desc.EffectClassType = ENECT_GEOMETRY
  148. desc.FileName = "dragonfly.rmd"
  149. desc.ScriptSet = ENSCRIPTSET_TRANSCHOPPER_HUMAN
  150. desc.MoveType = ENMOVE_FLYCONSTANTHEIGHT
  151. --desc.MoveType = ENMOVE_GROUND
  152. desc.RenderType = ENRENDERTYPE_GEOMETRY
  153. desc.Material = ENMAT_RIGIDSKINNEDMESH
  154. desc.MaterialColors = units_materialcolors_human
  155. desc.isPlacesVisible = true
  156.  
  157. -- shadow
  158. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_HELICOPTERALIENSHADOW)
  159. desc.ClassID = ENCLASS_MESHINSTANCE
  160. desc.EffectClassType = ENECT_GEOMETRY
  161. desc.FileName = "dragonfly.rmd"
  162. desc.RenderType = ENRENDERTYPE_SHADOW
  163. desc.Material = ENMAT_SHADOW
  164. desc.MaterialColors = units_materialcolors_shadow
  165.  
  166. -- register new unit to logic
  167. unitDesc = logic_getUnitDescP(39)
  168. unitDesc.group = 2
  169. unitDesc.order = 2
  170. unitDesc.unit_res_id = ENET_UNIT_TRANSCHOPPER_HUMAN
  171. unitDesc.unit_icon_id = "Dragonfly_h_small_normal.dds"
  172. unitDesc.active_id = "Dragonfly_h_small_active.dds"
  173. unitDesc.pressed_id = "Dragonfly_h_small_pressed.dds"
  174. unitDesc.big_icon_id = "Dragonfly_h_big_normal.dds"
  175. unitDesc.small_icon_id = "Dragonfly_l_human_stats.dds"
  176. unitDesc.HP = 3
  177. unitDesc.MP = 40
  178. unitDesc.WR = 0
  179. unitDesc.min_WR = 0
  180. unitDesc.WD = 0
  181. unitDesc.WR2 = 0
  182. unitDesc.min_WR2 = 0
  183. unitDesc.WD2 = 0
  184. unitDesc.ability = 5
  185. unitDesc.transport = 1
  186. unitDesc.value = 2
  187. unitDesc.race = 0
  188. unitDesc.fire_pause = 0.6
  189. unitDesc.move_pause = 0.5
  190. unitDesc.unit_info_scale = 0.07
  191. unitDesc.scn_name = "TRANSPCHOPPERH"
  192.